home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / TOTDEMO.ARJ / DEMMN9A.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-11  |  12KB  |  267 lines

  1. program DemoMenuNineA;
  2. {DEMMN9A - life without EZPull}
  3. USES  DOS, CRT,
  4.       totMENU, totFAST;
  5.  
  6. var
  7.   MenuAbout,MenuFile,MenuEdit,MenuSearch,MenuRun,MenuCompile,
  8.   MenuDebug,MenuOptions,MenuWindow,MenuHelp,
  9.   SubmenuEnv,SubmenuWatch: MenuOBJ;
  10.   Menu: PullMenuOBJ;
  11.   Choice: word;
  12.  
  13. procedure CreateSubMenus;
  14. {}
  15. begin
  16.    with SubMenuEnv do 
  17.    begin
  18.       Init;
  19.       SetForPull;
  20.       AddFullItem(' ~P~references... ',8061,80,'Specify desktop settings',nil);
  21.       AddFullItem(' ~E~ditor...      ',8062,69,'Specify editor settings',nil);
  22.       AddFullItem(' ~M~ouse...       ',8063,77,'Specify mouse settings',nil);
  23.       AddFullItem(' ~S~tartup...     ',8064,83,'Permanently change default startup options',nil);
  24.       AddFullItem(' ~C~olors...      ',8065,67,'Customize IDE colors for windows, menus, etc.',nil);
  25.    end;
  26.    with SubMenuWatch do
  27.    begin
  28.       Init;
  29.       SetForPull;
  30.       AddFullItem(' ~A~dd watch...       ',7021,65,'Insert a watch expression into the Watch window',nil);
  31.       AddFullItem(' ~D~elete watch       ',7022,68,'Remove the current watch expression from the Watch window',nil);
  32.       AddFullItem(' ~E~dit watch...      ',7023,69,'Edit the current watch expression in the Watch window',nil);
  33.       AddFullItem(' ~R~emove all watches ',7024,82,'Delete all watch expressions from the Watch window',nil);
  34.    end;
  35. end; {CreateSubMenus}
  36.  
  37. procedure CreateMainMenuBar;
  38. {}
  39. begin
  40.    with Menu do
  41.    begin
  42.       Init;
  43.       AddFullItem(' ≡ ',1,0,'System Commands',@MenuAbout);
  44.       AddFullItem(' ~F~ile ',2,70,'File management commands (Open, New, Save, etc.)',@MenuFile);
  45.       AddFullItem(' ~E~dit ',3,69,'Cut-and-paste editing commands',@MenuEdit);
  46.       AddFullItem(' ~S~earch ',4,83,'Text and error search commands',@MenuSearch);
  47.       AddFullItem(' ~R~un ',5,82,'Execute or single-step through a program',@MenuRun);
  48.       AddFullItem(' ~C~ompile ',6,67,'Compile to disk or memory',@MenuCompile);
  49.       AddFullItem(' ~D~ebug ',7,68,'Evaluate expressions, modify data, set breakpoints and watches',@MenuDebug);
  50.       AddFullItem(' ~O~ptions ',8,79,'Set defaults for compiler, editor, mouse, debugger, etc.',@MenuOptions);
  51.       AddFullItem(' ~W~indow ',9,87,'Open, arrange, and list windows',@MenuWindow);
  52.       AddFullItem(' ~H~elp ',10,72,'Get online help',@MenuHelp);
  53.    end;
  54. end; {CreateMainMenuBar}
  55.  
  56. procedure CreateMenus;
  57. {}
  58. var
  59.   Mtxt: Array[1..84] of string[90];
  60. begin
  61.    with MenuAbout do
  62.    begin
  63.       Init;
  64.       SetForPull;
  65.       AddFullItem(' ~A~bout...        ',101,65,'Show version and copyright information',nil);
  66.       AddFullItem(' ~R~efresh display ',102,82,'Redraw the screen',nil);
  67.       AddFullItem(' ~C~lear desktop   ',103,67,'Close all windows on the desktop, clear history lists',nil);
  68.    end;
  69.    with MenuFile do
  70.    begin
  71.       Init;
  72.       SetForPull;
  73.       AddFullItem(' ~O~pen...   F3  ',201,79,'Locate and open a file in an edit window',nil);
  74.       AddFullItem(' ~N~ew           ',202,78,'Create a new file in a new Edit window',nil);
  75.       AddFullItem(' ~S~ave      F2  ',203,83,'Save the file in the active Edit window',nil);
  76.       AddFullItem(' S~a~ve as...    ',204,65,'Save the current file under a different name',nil);
  77.       AddFullItem(' Save a~l~l      ',205,76,'Save all modified files',nil);
  78.       AddItem( '-');
  79.       AddFullItem( ' ~C~hange dir... ',206,67,'Choose a new default directory',nil);
  80.       AddFullItem( ' ~P~rint         ',207,80,'Print the contents of the active Edit window',nil);
  81.       AddFullItem( ' ~G~et info...   ',208,71,'Show status information',nil);
  82.       AddFullItem( ' ~D~OS shell     ',209,68,'Temporarily exit to DOS',nil);
  83.       AddFullItem( ' E~x~it          ',9999,88,'Exit Turbo Pascal',nil);
  84.    end;
  85.    with MenuEdit do
  86.    begin
  87.       Init;
  88.       SetForPull;
  89.       AddFullItem( ' ~R~estore line     ',301,82,'Cancel edits to the current line in active Edit window',nil);
  90.       SetStatus(1,false);
  91.       AddItem('-');
  92.       AddFullItem( ' Cu~t~    Shift-Del ',302,84,'Remove the selected text and put it in the Clipboard',nil);
  93.       SetStatus(3,false);
  94.       AddFullItem( ' ~C~opy    Ctrl-Ins ',303,67,'Copy the selected text into the Clipboard',nil);
  95.       SetStatus(4,false);
  96.       AddFullItem( ' ~P~aste  Shift-Ins ',304,80,'Insert selected text from the Clipboard',nil);
  97.       SetStatus(5,false);
  98.       AddFullItem( ' Copy e~x~ample     ',305,88,'Copy example from the Help window into the ClipBoard',nil);
  99.       SetStatus(6,false);
  100.       AddFullItem( ' ~S~how clipboard   ',306,83,'Open the Clipboard window',nil);
  101.       AddItem('-');
  102.       AddFullItem( ' C~l~ear   Ctrl-Del ',307,76,'Delete the selected text',nil);
  103.       SetStatus(9,false);
  104.    end;
  105.    with MenuSearch do
  106.    begin
  107.       Init;
  108.       SetForPull;
  109.       AddFullItem( ' ~F~ind...             ',401,70,'Search for text',nil);
  110.       AddFullItem( ' ~R~eplace...          ',402,82,'Search for text and replace it with new text',nil);
  111.       AddFullItem( ' ~S~earch again        ',403,83,'Repeat the last Find or Replace command',nil);
  112.       AddFullItem( ' ~G~oto line number... ',404,71,'Move the cursor to a specified line number',nil);
  113.       AddFullItem( ' ~F~ind procedure...   ',405,70,'Search for a procedure or function while debugging',nil);
  114.       AddFullItem( ' Find e~r~ror...       ',406,82,'Move the cursor to the position of a runtime error',nil);
  115.    end;
  116.    with MenuRun do
  117.    begin
  118.       Init;
  119.       SetForPull;
  120.       AddFullItem( ' ~R~un            Ctrl-F9 ',501,82,'Run the current program',nil);
  121.       AddFullItem( ' ~P~rogram reset  Ctrl-F2 ',502,80,'Halt debugging session and release memory',nil);
  122.       SetStatus(2,false);
  123.       AddFullItem( ' ~G~o to cursor        F4 ',503,71,'Run program from the run bar to the cursor position',nil);
  124.       AddFullItem( ' ~T~race into          F7 ',504,84,'Execute next statement, stopping within the current proc',nil);
  125.       AddFullItem( ' ~S~tep over           F8 ',505,83,'Execute next statement, skipping over the current proc',nil);
  126.       AddFullItem( ' P~a~rameters...          ',506,65,'Set command line parameters to be passed to the program',nil);
  127.    end;
  128.    with MenuCompile do
  129.    begin
  130.       Init;
  131.       SetForPull;
  132.       AddFullItem( ' ~C~ompile  Alt-F9 ',601,67,'Compile source file',nil);
  133.       AddFullItem( ' ~M~ake         F9 ',602,77,'Rebuild source file and all modified files',nil);
  134.       AddFullItem( ' ~B~uild           ',603,66,'Rebuild source file and all files',nil);
  135.       AddFullItem( ' ~D~estination     ',604,68,'Specify whether file is compiled to memory or disk',nil);
  136.       AddFullItem( ' ~P~rimary file... ',605,80,'Define the file that is the focus of make and Build',nil);
  137.    end;
  138.    with MenuDebug do
  139.    begin
  140.       Init;
  141.       SetForPull;
  142.       AddFullItem( ' ~E~valute/modify...  Ctrl-F4 ',701,69,
  143.                    'Evaluate a variable or expression and display or modify the value',nil);
  144.       AddFullItem( ' ~W~atches                   ',702,87,
  145.                    'Add, delete and edit expressions in the watch window',@SubMenuWatch);
  146.       AddFullItem( ' ~T~oggle breakpoint  Ctrl-F8 ',703,84,
  147.                    'Set or clear an unconditional breakpoint at the cursor position',nil);
  148.       AddFullItem( ' ~B~reakpoints...    ',704,66,
  149.                    'Set conditional breakpoints, view and edit breakpoints',nil);
  150.    end;
  151.    with MenuOptions do
  152.    begin
  153.       Init;
  154.       SetForPull;
  155.       AddFullItem( ' ~C~ompiler            ',801,67,'Set default compiler directives and condl. defines',nil);
  156.       AddFullItem( ' ~M~emory sizes...     ',802,77,'Set default stack and heap sizes for generated programs',nil);
  157.       AddFullItem( ' ~L~inker...           ',803,76,'Set linker options',nil);
  158.       AddFullItem( ' De~b~ugger...         ',804,66,'Set debugger options',nil);
  159.       AddFullItem( ' ~D~irectories...      ',805,68,'Set paths for units, include files, OBJs anfd generated files',nil);
  160.       AddItem('-');
  161.       AddFullItem( ' ~E~nvironment        ',806,69,'Specify environment settings',@SubMenuEnv);
  162.       AddItem('-');
  163.       AddFullItem( ' ~S~ave options...     ',807,83,'Save all the settings you''ve made in the Options menu',nil);
  164.       AddFullItem( ' ~R~etrieve options... ',808,82,'Load options file previously created with Save Options',nil);
  165.    end;
  166.    with MenuWindow do
  167.    begin
  168.       Init;
  169.       SetForPull;
  170.       AddFullItem( ' ~S~ize/Move   Ctrl-F5 ',901,83,'Change the size or position of the active window',nil);
  171.       AddFullItem( ' ~Z~oom             F5 ',902,90,'Enlarge or restore the size of the active window',nil);
  172.       AddFullItem( ' ~T~ile                ',903,84,'Arrange windows on desktop by tiling',nil);
  173.       AddFullItem( ' C~a~scade             ',904,65,'Arrange windows on desktop by cascading',nil);
  174.       AddFullItem( ' ~N~ext             F6 ',905,78,'Make the next window active',nil);
  175.       AddFullItem( ' ~P~revious   Shift-F6 ',906,80,'Make the previous window active',nil);
  176.       AddFullItem( ' ~C~lose        Alt-F3 ',907,67,'Close the active window',nil);
  177.       AddItem('-');
  178.       AddFullItem( ' ~W~atch               ',908,87,'Open the watch window',nil);
  179.       AddFullItem( ' ~R~egister            ',909,82,'Open the Register window',nil);
  180.       AddFullItem( ' ~O~utput              ',910,79,'Open the Output window',nil);
  181.       AddFullItem( ' Call stac~k~  Ctrl-F3 ',911,75,'Show the procedures the program called to reach this point',nil);
  182.       AddFullItem( ' ~U~ser screen  Alt-F5 ',912,85,'Switch to the full-screen user output',nil);
  183.       AddItem('-');
  184.       AddFullItem( ' ~L~ist...       Alt-0 ',913,76,'Show a list of all open windows',nil);
  185.    end;
  186.    with MenuHelp do
  187.    begin
  188.       Init;
  189.       SetForPull;
  190.       AddFullItem( ' ~C~ontents               ',1001,67,'Show table of contents of online Help',nil);
  191.       AddFullItem( ' ~I~ndex         Shift-F1 ',1002,73,'Show index for online Help',nil);
  192.       AddFullItem( ' ~T~opic Search   Ctrl-F1 ',1003,84,'Display help on the word at the cursor',nil);
  193.       AddFullItem( ' ~P~revious Topic  Alt-F1 ',1004,80,'Redisplay the last-viewed online Help screen',nil);
  194.       AddFullItem( ' ~H~elp on Help           ',1005,72,'How to use online Help',nil);
  195.    end;
  196. end; {CreateMenus}
  197.  
  198. procedure AssignSpecialkeys;
  199. {}
  200. begin
  201.    with Menu do
  202.    begin
  203.       SetSpecialKey(317,201); {F3}
  204.       SetSpecialKey(316,203); {F2}
  205.       SetSpecialKey(301,9999); {Alt-X}
  206.       SetSpecialKey(263,302); {Shift-Del}
  207.       SetSpecialKey(260,303); {Ctrl-Ins}
  208.       SetSpecialKey(291,304); {Shift-Ins}
  209.       SetSpecialKey(262,307); {Ctrl-Del}
  210.       SetSpecialKey(358,501); {Ctrl-F9}
  211.       SetSpecialKey(351,502); {Ctrl-F2}
  212.       SetSpecialKey(318,503); {F4}
  213.       SetSpecialKey(321,504); {F7}
  214.       SetSpecialKey(322,505); {F8}
  215.       SetSpecialKey(368,601); {Alt-F9}
  216.       SetSpecialKey(323,602); {F9}
  217.       SetSpecialKey(353,701); {Ctrl-F4}
  218.       SetSpecialKey(357,703); {Ctrl-F8}
  219.       SetSpecialKey(354,901); {Ctrl-F5}
  220.       SetSpecialKey(319,902); {F5}
  221.       SetSpecialKey(320,905); {F6}
  222.       SetSpecialKey(345,906); {Shift-F6}
  223.       SetSpecialKey(362,907); {Alt-F3}
  224.       SetSpecialKey(352,911); {Ctrl-F3}
  225.       SetSpecialKey(364,912); {Alt-F5}
  226.       SetSpecialKey(385,913); {Alt-0}
  227.       SetSpecialKey(340,1002); {Shift-F1}
  228.       SetSpecialKey(350,1003); {Ctrl-F1}
  229.       SetSpecialKey(360,1004); {Alt-F1}
  230.    end;
  231. end; {AssignSpecialKeys}
  232.  
  233. procedure DisposeMenus;
  234. {}
  235. begin
  236.   MenuAbout.Done;
  237.   MenuFile.Done;
  238.   MenuEdit.Done;
  239.   MenuSearch.Done;
  240.   MenuRun.Done;
  241.   MenuCompile.Done;
  242.   MenuDebug.Done;
  243.   MenuOptions.Done;
  244.   MenuWindow.Done;
  245.   MenuHelp.Done;
  246.   SubmenuEnv.Done;
  247.   SubmenuWatch.Done;
  248.   Menu.Done;
  249. end; {DisposeMenus}
  250.  
  251. begin
  252.    Screen.PartClear(1,2,80,24,white,'░'); {paint the screen}
  253.    Screen.PartClear(1,1,80,1,31,' ');
  254.    Screen.PartClear(1,25,80,25,31,' ');
  255.    Screen.WritePlain(9,25,'│');
  256.    CreateMenus;
  257.    CreateMainMenuBar;
  258.    CreateSubMenus;
  259.    AssignSpecialkeys;
  260.    Choice := Menu.Push(13,0,0);   {Pass Enter to make menu pull down}
  261.    DisposeMenus;
  262.    GotoXY(25,15);
  263.    if Choice = 0 then
  264.       Writeln('You escaped')
  265.    else
  266.       Writeln('You selected menu item ',Choice);
  267. end.